Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parser : support admin repair table syntax #547

Merged
merged 4 commits into from
Oct 21, 2019

Conversation

AilinKid
Copy link
Contributor

@AilinKid AilinKid commented Sep 4, 2019

What problem does this PR solve?

For ISSUE to fix tableInfo (Meta) in KV store.
Bad tableInfo will be loaded error leading TiDB crash when it restart.
So we support a new syntax to repair bad tableInfo in meta (using new tableInfo build from create table statement to override the bad tableInfo, that means user should keep new tableInfo correct)

Backgound : In some corner cases or encountering serious bugs, DDL operations update table structure error occurred, causing TiDB panic and failing to restart the service.

ADMIN REPAIR TABLE  table_name CREATE TABLE STATEMENT

Related TiDB PR #12046
Related Design Doc : fix broken table

What is changed and how it works?

In adminstmt parser.yy : add a new syntax
ADMIN REPAIR TABLE table_name CREATE TABLE STATEMENT

Check List

Tests

  • Unit test
  • Integration test

@CLAassistant
Copy link

CLAassistant commented Sep 4, 2019

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Sep 4, 2019

Codecov Report

Merging #547 into master will decrease coverage by 0.04%.
The diff coverage is 54.54%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #547      +/-   ##
==========================================
- Coverage   71.77%   71.72%   -0.05%     
==========================================
  Files          32       32              
  Lines        7802     7824      +22     
==========================================
+ Hits         5600     5612      +12     
- Misses       1674     1679       +5     
- Partials      528      533       +5
Impacted Files Coverage Δ
parser.go 70.58% <ø> (ø) ⬆️
model/ddl.go 76.99% <ø> (ø) ⬆️
ast/ddl.go 80.21% <54.54%> (-0.35%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 45304b7...43c053b. Read the comment docs.

@codecov
Copy link

codecov bot commented Sep 4, 2019

Codecov Report

Merging #547 into master will decrease coverage by 0.1%.
The diff coverage is 54.54%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #547      +/-   ##
==========================================
- Coverage   71.83%   71.72%   -0.11%     
==========================================
  Files          32       32              
  Lines        7836     7824      -12     
==========================================
- Hits         5629     5612      -17     
- Misses       1676     1679       +3     
- Partials      531      533       +2
Impacted Files Coverage Δ
parser.go 70.58% <ø> (+0.21%) ⬆️
model/ddl.go 76.99% <ø> (ø) ⬆️
ast/ddl.go 80.21% <54.54%> (-0.27%) ⬇️
ast/dml.go 73.56% <0%> (-0.37%) ⬇️
goyacc/main.go 0% <0%> (ø) ⬆️
misc.go 96.49% <0%> (ø) ⬆️
ast/functions.go 76.74% <0%> (ø) ⬆️
ast/misc.go 74.46% <0%> (+0.09%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6fc90a9...9f383a3. Read the comment docs.

@AilinKid
Copy link
Contributor Author

AilinKid commented Sep 5, 2019

/run-all-tests

@kennytm
Copy link
Contributor

kennytm commented Sep 5, 2019

The syntax looks weird. What happens with ADMIN REPAIR TABLE x CREATE TABLE y ... ?

@AilinKid
Copy link
Contributor Author

AilinKid commented Sep 5, 2019

The syntax looks weird. What happens with ADMIN REPAIR TABLE x CREATE TABLE y ... ?

just rename the table, cause override will use the old table id, index id, so it's ok.

@tiancaiamao
Copy link
Collaborator

LGTM
I hope we never use it although.

@AilinKid
Copy link
Contributor Author

@kennytm @tangenta PTAL

Copy link
Contributor

@kennytm kennytm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kennytm kennytm added status/LGT2 LGT2 and removed status/LGT1 LGT1 labels Oct 21, 2019
@kennytm kennytm merged commit 646d641 into pingcap:master Oct 21, 2019
tiancaiamao pushed a commit to tiancaiamao/parser that referenced this pull request Apr 27, 2021
* support admin repair table

* fix comment

* add ddl test

* fix depency
lyonzhi pushed a commit to lyonzhi/parser that referenced this pull request Apr 25, 2024
* support admin repair table

* fix comment

* add ddl test

* fix depency
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants